import axios from './axios.js';

export default {
    namespaced: true,
    state: {},
    actions: {
        /**
         * 获取所有展位位置
         * @param commit
         * @param state
         * @param params 请求参数
         * @return {Promise<*[e, data]>} e错误信息，data数据
         */
        async basicsListApi({commit, state}, params) {
            try {
                let {data} = await axios.get('/api/account/basics/list', {params});
                return [null, data]
            } catch (e) {
                return [e, null]
            }
        }, 
		/**
         * 获取广告
         * @param commit
         * @param state
         * @param params 请求参数
         * @return {Promise<*[e, data]>} e错误信息，data数据
         */
        async advertApi({commit, state}, params) {
            try {
                let {data} = await axios.get('/api/sense/mobile/advert', {params});
                return [null, data]
            } catch (e) {
                return [e, null]
            }
        },
		/**
         * 获取公告
         * @param commit
         * @param state
         * @param params 请求参数
         * @return {Promise<*[e, data]>} e错误信息，data数据
         */
        async noticeApi({commit, state}, params) {
            try {
                let {data} = await axios.get('/api/sense/mobile/notice', {params});
                return [null, data]
            } catch (e) {
                return [e, null]
            }
        },
		/**
         * 获取系统配置接口
         * @param commit
         * @param state
         * @param params 请求参数
         * @return {Promise<*[e, data]>} e错误信息，data数据
         */
        async getConfigApi({commit, state}, params) {
            try {
                let {data} = await axios.post('/api/account/config', params);
				
				let obj = data.data.reduce((obj1,item)=>{
					obj1[item.config_name] = item
					return obj1
				},{})
				commit('setConfig', obj , {root: true});
                return [null, data]
            } catch (e) {
                return [e, null]
            }
        },
		/**
         * 获取我的推广人
         * @param commit
         * @param state
         * @param params 请求参数
         * @return {Promise<*[e, data]>} e错误信息，data数据
         */
        async promoMayApi({commit, state}, params) {
            try {
                let {data} = await axios.get('/api/account/promo_app/get_promoter', {params});
                return [null, data]
            } catch (e) {
                return [e, null]
            }
        },
		/**
		 * 我推广的用户列表
		 * @param commit
		 * @param state
		 * @param params 请求参数
		 * @return {Promise<*[e, data]>} e错误信息，data数据
		 */
		async promoListApi({commit, state}, params) {
		    try {
		        let {data} = await axios.get('/api/account/promo_app/list', {params});
		        return [null, data]
		    } catch (e) {
		        return [e, null]
		    }
		},
		 /**
         * 手动添加用户信息
         * @param commit
         * @param state
         * @param params 请求参数
         * @return {Promise<*[e, data]>} e错误信息，data数据
         */
        async addUserApi({commit, state}, params) {
            try {
                let {data} = await axios.post('/api/account/user', params);
                return [null, data]
            } catch (e) {
                return [e, null]
            }
        },
		/**
         * 编辑用户信息
         * @param commit
         * @param state
         * @param params 请求参数
         * @return {Promise<*[e, data]>} e错误信息，data数据
         */
        async editUserApi({commit, state}, params) {
            try {
                let {data} = await axios.put('/api/account/user', params);
                return [null, data]
            } catch (e) {
                return [e, null]
            }
        },
		/**
		 * 删除用户信息
		 * @param commit
		 * @param state
		 * @param params 请求参数
		 * @return {Promise<*[e, data]>} e错误信息，data数据
		 */
		async delUserApi({commit, state}, params) {
		    try {
		        let {data} = await axios.delete(`/api/account/user/${params.user_id}`,{params});
		        return [null, data]
		    } catch (e) {
		        return [e, null]
		    }
		},
		/**
		 * 删除用户信息
		 * @param commit
		 * @param state
		 * @param params 请求参数
		 * @return {Promise<*[e, data]>} e错误信息，data数据
		 */
		async delUserApi({commit, state}, params) {
		    try {
		        let {data} = await axios.delete(`/api/account/user/${params.user_id}`,{params});
		        return [null, data]
		    } catch (e) {
		        return [e, null]
		    }
		},
		/**
		 * 上传头像文件服务器
		 * @param commit
		 * @param state
		 * @param params 请求参数
		 * @return {Promise<*[e, data]>} e错误信息，data数据
		 */
		async addFileApi({commit, state}, params) {
		    try {
				console.log(state);
		        let {data} = await axios.post(`/api/account/user/add_file/${params.user_id}`,params.file);
		        return [null, data]
		    } catch (e) {
		        return [e, null]
		    }
		},
		
		/**
		 * 发送手机验证码
		 * @param commit
		 * @param state
		 * @param params 请求参数
		 * @return {Promise<*[e, data]>} e错误信息，data数据
		 */
		async codePhoneApi({commit, state}, params) {
		    try {
		        let {data} = await axios.get(`/api/account/basics/phone_code/${params.type}/${params.phone}`);
		        return [null, data]
		    } catch (e) {
		        return [e, null]
		    }
		},
		/**
		 * 发送邮箱验证码
		 * @param commit
		 * @param state
		 * @param params 请求参数
		 * @return {Promise<*[e, data]>} e错误信息，data数据
		 */
		async codeEmailApi({commit, state}, params) {
		    try {
		        let {data} = await axios.get(`/api/account/basics/email_code/${params.type}/${params.email}`);
		        return [null, data]
		    } catch (e) {
		        return [e, null]
		    }
		},
		
		/**
		 * 更改绑定邮箱
		 * @param commit
		 * @param state
		 * @param params 请求参数
		 * @return {Promise<*[e, data]>} e错误信息，data数据
		 */
		async changerEmailApi({commit, state}, params) {
		    try {
		        let {data} = await axios.put('/api/account/user/changer_email', params);
		        return [null, data]
		    } catch (e) {
		        return [e, null]
		    }
		},
		/**
		 * 更改密码
		 * @param commit
		 * @param state
		 * @param params 请求参数
		 * @return {Promise<*[e, data]>} e错误信息，data数据
		 */
		async changerPasswordApi({commit, state}, params) {
		    try {
		        let {data} = await axios.put('/api/account/user/changer_password', params);
		        return [null, data]
		    } catch (e) {
		        return [e, null]
		    }
		},
		/**
		 * 更改绑定手机号
		 * @param commit
		 * @param state
		 * @param params 请求参数
		 * @return {Promise<*[e, data]>} e错误信息，data数据
		 */
		async changerPhoneApi({commit, state}, params) {
		    try {
		        let {data} = await axios.put('/api/account/user/changer_phone', params);
		        return [null, data]
		    } catch (e) {
		        return [e, null]
		    }
		},
		/**
		 * 注销
		 * @param commit
		 * @param state
		 * @param params 请求参数
		 * @return {Promise<*[e, data]>} e错误信息，data数据
		 */
		async logoutApi({commit, state}, params) {
		    try {
		        let {data} = await axios.get(`/api/account/user/logout/${params.client}/${params.user_id}`, {params});
		        return [null, data]
		    } catch (e) {
		        return [e, null]
		    }
		},
		/**
		 * 查询地区信息
		 * @param commit
		 * @param state
		 * @param params 请求参数
		 * @return {Promise<*[e, data]>} e错误信息，data数据
		 */
		async regionListApi({commit, state}, params) {
		    try {
		        let {data} = await axios.get('/api/account/region/list', {params});
		        let list = data;
				console.log(data)
				list.forEach(item => {
		        	item.text = item.region_name;
		        	item.value = item.id;
					console.log(item.children&&item.children.length)
		        	if (item.children&&item.children.length) {
		        		item.children.forEach(item1 => {
		        			item1.text = item1.region_name;
		        			item1.value = item1.id;
							delete item1.children;
		        			// if (item1.children.length) {
		        			// 	item1.children.forEach(item2 => {
		        			// 		item2.text = item2.region_name;
		        			// 		delete item2.children;
		        			// 	})
		        			// }
		        		})
		        	}else{
						item.children = [];
					}
		        })
				console.log(list)
		        commit('setRegion', list, {root: true});
				return [null, data]
		    } catch (e) {
		        return [e, null]
		    }
		},
		/**
		 * 用户绑定银行卡
		 * @param commit
		 * @param state
		 * @param params 请求参数
		 * @return {Promise<*[e, data]>} e错误信息，data数据
		 */
		async bindBankApi({commit, state}, params) {
		    try {
		        let {data} = await axios.post('/api/account/app_bank/bind', params);
		        return [null, data]
		    } catch (e) {
		        return [e, null]
		    }
		},
		/**
		 * 用户银行卡列表
		 * @param commit
		 * @param state
		 * @param params 请求参数
		 * @return {Promise<*[e, data]>} e错误信息，data数据
		 */
		async bankListApi({commit, state}, params) {
		    try {
		        let {data} = await axios.get('/api/account/app_bank/list', {params});
		        return [null, data]
		    } catch (e) {
		        return [e, null]
		    }
		},
		/**
		 * 用户解绑银行卡接口
		 * @param commit
		 * @param state
		 * @param params 请求参数
		 * @return {Promise<*[e, data]>} e错误信息，data数据
		 */
		async unbindApi({commit, state}, params) {
		    try {
		        let {data} = await axios.put(`/api/account/app_bank/unbind/${params.id}`);
		        return [null, data]
		    } catch (e) {
		        return [e, null]
		    }
		},
		/**
		 * 用户vip详情
		 * @param commit
		 * @param state
		 * @param params 请求参数
		 * @return {Promise<*[e, data]>} e错误信息，data数据
		 */
		async vipDetailApi({commit, state}, params) {
		    try {
		        let {data} = await axios.get('/api/account/vip/detail', {params});
				commit('setVip', data, {root: true});
		        return [null, data]
		    } catch (e) {
		        return [e, null]
		    }
		},
		/**
		 * 会员套餐列表
		 * @param commit
		 * @param state
		 * @param params 请求参数
		 * @return {Promise<*[e, data]>} e错误信息，data数据
		 */
		async productListApi({commit, state}, params) {
		    try {
		        let {data} = await axios.get('/api/account/product_app/list',params);
		        return [null, data]
		    } catch (e) {
		        return [e, null]
		    }
		},
		/**
		 * 用户购买VIP
		 * @param commit
		 * @param state
		 * @param params 请求参数
		 * @return {Promise<*[e, data]>} e错误信息，data数据
		 */
		async vipOrderApi({commit, state}, params) {
		    try {
		        let {data} = await axios.post('/api/account/vip_order_app/init',params);
		        return [null, data]
		    } catch (e) {
		        return [e, null]
		    }
		},
		
		/**
		 * 法律法规/法律专题全文关键词检索
		 * @param commit
		 * @param state
		 * @param params 请求参数
		 * @return {Promise<*[]>}
		 */
		async keyListApi({commit, state}, params) {
		    try {
		        let {data} = await axios.post('/api/sense/regulation/list/es', params);
		        return [null, data]
		    } catch (e) {
		        return [e, null]
		    }
		},
		/**
		 * 法律法规,法律专题,合同详情
		 * @param commit
		 * @param state
		 * @param params 请求参数
		 * @return {Promise<*[]>}
		 */
		async regulationApi({commit, state}, params) {
		    try {
		        let {data} = await axios.get('/api/sense/basics/nous', {params});
		        return [null, data]
		    } catch (e) {
		        return [e, null]
		    }
		},
		/**
		 * 法律法规,法律专题,合同查询
		 * @param commit
		 * @param state
		 * @param params 请求参数
		 * @return {Promise<*[]>}
		 */
		async regulationListApi({commit, state}, params) {
		    try {
		        let {data} = await axios.post('/api/sense/regulation/list', params);
		        return [null, data]
		    } catch (e) {
		        return [e, null]
		    }
		},
		/**
		 * 法律法规,法律专题,合同分类分页查询
		 * @param commit
		 * @param state
		 * @param params 请求参数
		 * @return {Promise<*[]>}
		 */
		async categoryListApi({commit, state}, params) {
		    try {
		        let {data} = await axios.post('/api/sense/regulation/category/list', params);
				
		        return [null, data]
		    } catch (e) {
		        return [e, null]
		    }
		},
		/**
		 * 费用计算器
		 * @param commit
		 * @param state
		 * @param params 请求参数
		 * @return {Promise<*[]>}
		 */
		async calculatorFeeApi({commit, state}, params) {
		    try {
		        let {data} = await axios.post('/api/sense/calculator/fee', params);
		        return [null, data]
		    } catch (e) {
		        return [e, null]
		    }
		},
		/**
		 * 费用类型
		 * @param commit
		 * @param state
		 * @param params 请求参数
		 * @return {Promise<*[]>}
		 */
		async typeListApi({commit, state}, params) {
		    try {
		        let {data} = await axios.post('/api/sense/cost/type/list', params);
		        return [null, data]
		    } catch (e) {
		        return [e, null]
		    }
		},
		/**
		 * 查询合同服务费用配置列表
		 * @param commit
		 * @param state
		 * @param params 请求参数
		 * @return {Promise<*[]>}
		 */
		async getClericalApi({commit, state}, params) {
		    try {
		        let {data} = await axios.post('/api/sense/clerical/get', params);
		        return [null, data]
		    } catch (e) {
		        return [e, null]
		    }
		},	
		
		/**
		 * 查询当前用户未完成的合同服务
		 * @param commit
		 * @param state
		 * @param params 请求参数
		 * @return {Promise<*[]>}
		 */
		async getWritApi({commit, state}, params) {
		    try {
		        let {data} = await axios.get('/api/sense/writ', {params});
		        return [null, data]
		    } catch (e) {
		        return [e, null]
		    }
		},
		/**
		 * 客户提交合同服务需求
		 * @param commit
		 * @param state
		 * @param params 请求参数
		 * @return {Promise<*[]>}
		 */
		async addWritApi({commit, state}, params) {
		    try {
		        let {data} = await axios.post('/api/sense/writ', params);
		        return [null, data]
		    } catch (e) {
		        return [e, null]
		    }
		},
		/**
		 * 编辑合同服务需求
		 * @param commit
		 * @param state
		 * @param params 请求参数
		 * @return {Promise<*[]>}
		 */
		async editWritApi({commit, state}, params) {
		    try {
		        let {data} = await axios.put('/api/sense/writ', params);
		        return [null, data]
		    } catch (e) {
		        return [e, null]
		    }
		},
		/**
		 * 查询草拟/审核合同列表
		 * @param commit
		 * @param state
		 * @param params 请求参数
		 * @return {Promise<*[]>}
		 */
		async writListApi({commit, state}, params) {
		    try {
		        let {data} = await axios.post('/api/sense/writ/list', params);
		        return [null, data]
		    } catch (e) {
		        return [e, null]
		    }
		},
		/**
		 * 查询我的下载列表
		 * @param commit
		 * @param state
		 * @param params 请求参数
		 * @return {Promise<*[]>}
		 */
		async downloadListApi({commit, state}, params) {
		    try {
		        let {data} = await axios.post('/api/sense/pay/download/list', params);
		        return [null, data]
		    } catch (e) {
		        return [e, null]
		    }
		},/**
		 * 查询我的下载列表
		 * @param commit
		 * @param state
		 * @param params 请求参数
		 * @return {Promise<*[]>}
		 */
		async payDownloaApi({commit, state}, params) {
		    try {
		        let {data} = await axios.post('/api/sense/pay/download', params);
		        return [null, data]
		    } catch (e) {
		        return [e, null]
		    }
		},
		/**
		 * 下载word文档
		 * @param commit
		 * @param state
		 * @param params 请求参数
		 * @return {Promise<*[]>}
		 */
		async payDownloadApi({commit, state}, params) {
		    try {
		        let {data} = await axios.get(`/api/sense/pay/download/${params.id}`, {params});
		        return [null, data]
		    } catch (e) {
		        return [e, null]
		    }
		},
		/**
		 * 查询单条数据
		 * @param commit
		 * @param state
		 * @param params 请求参数
		 * @return {Promise<*[]>}
		 */
		async downloadApi({commit, state}, params) {
		    try {
		        let {data} = await axios.get("/api/sense/pay/download", {params});
		        return [null, data]
		    } catch (e) {
		        return [e, null]
		    }
		},
		
		/**
		 * 获取用户充值流水
		 * @param commit
		 * @param state
		 * @param params 请求参数
		 * @return {Promise<*[]>}
		 */
		async orderRechargeApi({commit, state}, params) {
		    try {
		        let {data} = await axios.post(`/api/finance/order_recharge/get_user/${params.userId}`, params);
		        return [null, data]
		    } catch (e) {
		        return [e, null]
		    }
		},
		/**
		 * 获取用户提现流水
		 * @param commit
		 * @param state
		 * @param params 请求参数
		 * @return {Promise<*[]>}
		 */
		async orderWithdrawApi({commit, state}, params) {
		    try {
		        let {data} = await axios.post(`/api/finance/order_withdraw/get_user/${params.userId}`, params);
		        return [null, data]
		    } catch (e) {
		        return [e, null]
		    }
		},
		/**
		 * 提现申请
		 * @param commit
		 * @param state
		 * @param params 请求参数
		 * @return {Promise<*[]>}
		 */
		async insertWithdrawApi({commit, state}, params) {
		    try {
		        let {data} = await axios.post('/api/finance/order_withdraw/insert', params);
		        return [null, data]
		    } catch (e) {
		        return [e, null]
		    }
		},
		/**
		 * 提现到支付宝
		 * @param commit
		 * @param state
		 * @param params 请求参数
		 * @return {Promise<*[]>}
		 */
		async checkWithdrawApi({commit, state}, params) {
		    try {
		        let {data} = await axios.get('/api/finance/order_withdraw/check', {params});
		        return [null, data]
		    } catch (e) {
		        return [e, null]
		    }
		},
		/**
		 * 账号充值
		 * @param commit
		 * @param state
		 * @param params 请求参数
		 * @return {Promise<*[]>}
		 */
		async insertRechargeApi({commit, state}, params) {
		    try {
		        let {data} = await axios.post('/api/finance/order_recharge/insert', params);
		        return [null, data]
		    } catch (e) {
		        return [e, null]
		    }
		},
		/**
		 * 律所信息接口
		 * @param commit
		 * @param state
		 * @param params 请求参数
		 * @return {Promise<*[]>}
		 */
		async lawFirmApi({commit, state}, params) {
		    try {
		        let {data} = await axios.post('/api/account/lawfirm/query', params);
				let arr = [];
				if(data.data&&data.data.length){
					arr = data.data.reduce((arry,item)=>{
						item.type_name = item.lawfirm_name;
						item.text = item.lawfirm_name;
						arry.push(item);
						return arry
					},[])
				}
				commit('setLawFirm', arr, {root: true});
		        return [null, data]
		    } catch (e) {
		        return [e, null]
		    }
		},
		/**
		 * 修改律师相关信息，如从业年限，擅长领域等
		 * @param commit
		 * @param state
		 * @param params 请求参数
		 * @return {Promise<*[]>}
		 */
		async updateLawyerApi({commit, state}, params) {
		    try {
		        let {data} = await axios.put('/api/account/lawyer_certification/update', params);
		        return [null, data]
		    } catch (e) {
		        return [e, null]
		    }
		},
		/**
		 * 修改律师擅长领域
		 * @param commit
		 * @param state
		 * @param params 请求参数
		 * @return {Promise<*[]>}
		 */
		async updateTypeApi({commit, state}, params) {
		    try {
		        let {data} = await axios.put(`/api/account/lawyer_certification/update_type/${params.user_id}`, params.certificate_type);
		        return [null, data]
		    } catch (e) {
		        return [e, null]
		    }
		},
		/**
		 * 查询律师认证信息
		 * @param commit
		 * @param state
		 * @param params 请求参数
		 * @return {Promise<*[]>}
		 */
		async oneLawyerApi({commit, state}, params) {
		    try {
		        let {data} = await axios.get('/api/account/lawyer_certification/one', {params});
		        return [null, data]
		    } catch (e) {
		        return [e, null]
		    }
		},
		/**
		 * 获取用户订单列表
		 * @param commit
		 * @param state
		 * @param params 请求参数
		 * @return {Promise<*[]>}
		 */
		async getOrderApi({commit, state}, params) {
		    try {
		        let {data} = await axios.post('/api/finance/order/get_order', params);
		        return [null, data]
		    } catch (e) {
		        return [e, null]
		    }
		},
		/**
		 * 获取各种消费流水（合同、展位……）
		 * @param commit
		 * @param state
		 * @param params 请求参数
		 * @return {Promise<*[]>}
		 */
		async getUserApi({commit, state}, params) {
		    try {
		        let {data} = await axios.post('/api/finance/account_user/list', params);
		        return [null, data]
		    } catch (e) {
		        return [e, null]
		    }
		},
		/**
		 * 获取某一笔订单明细
		 * @param commit
		 * @param state
		 * @param params 请求参数
		 * @return {Promise<*[]>}
		 */
		async getUserInfoApi({commit, state}, params) {
		    try {
		        let {data} = await axios.post(`/api/finance/order/get_user/${params.order_id}`, params);
		        return [null, data]
		    } catch (e) {
		        return [e, null]
		    }
		},
		/**
		 * 获取某一笔订单明细
		 * @param commit
		 * @param state
		 * @param params 请求参数
		 * @return {Promise<*[]>}
		 */
		async lawfirmsApi({commit, state}, params) {
		    try {
		        let {data} = await axios.post('/api/account/lawfirm', params);
		        return [null, data]
		    } catch (e) {
		        return [e, null]
		    }
		},
		/**
		 * 加盟申请
		 * @param commit
		 * @param state
		 * @param params 请求参数
		 * @return {Promise<*[]>}
		 */
		async applyApi({commit, state}, params) {
		    try {
		        let {data} = await axios.post('/api/account/alliance/apply', params);
		        return [null, data]
		    } catch (e) {
		        return [e, null]
		    }
		},
		/**
		 * 支付宝支付
		 * @param commit
		 * @param state
		 * @param params 请求参数
		 * @return {Promise<*[]>}
		 */
		async aliAppApi({commit, state}, params) {
		    try {
		        let {data} = await axios.post(`/api/finance/alipay/ali_app`,params);
		        return [null, data]
		    } catch (e) {
		        return [e, null]
		    }
		},
		/**
		 * 微信支付
		 * @param commit
		 * @param state
		 * @param params 请求参数
		 * @return {Promise<*[]>}
		 */
		async wxpayApi({commit, state}, params) {
		    try {
		        let {data} = await axios.get('/api/finance/wxpay/app',{params});
		        return [null, data]
		    } catch (e) {
		        return [e, null]
		    }
		},
		/**
		 * 余额支付
		 * @param commit
		 * @param state
		 * @param params 请求参数
		 * @return {Promise<*[]>}
		 */
		async balancepayApi({commit, state}, params) {
		    try {
				console.log(params);
		        let {data} = await axios.post(`/api/finance/account_user/balance_pay/${params.orderId}`,params);
		        return [null, data]
		    } catch (e) {
		        return [e, null]
		    }
		},
		/**
		 * 获取邀请码
		 * @param commit
		 * @param state
		 * @param params 请求参数
		 * @return {Promise<*[]>}
		 */
		async icodeApi({commit, state}, params) {
		    try {
		        let {data} = await axios.post(`/api/account/user/icode/${params.size}`,params);
		        return [null, data]
		    } catch (e) {
		        return [e, null]
		    }
		},
		/**
		 * 获取邀请码
		 * @param commit
		 * @param state
		 * @param params 请求参数
		 * @return {Promise<*[]>}
		 */
		async icodeApi({commit, state}, params) {
		    try {
		        let {data} = await axios.get(`/api/account/user/icode/${params.size}`);
		        return [null, data]
		    } catch (e) {
		        return [e, null]
		    }
		},
		/**
		 * 获取邀请连接
		 * @param commit
		 * @param state
		 * @param params 请求参数
		 * @return {Promise<*[]>}
		 */
		async getLinkApi({commit, state}, params) {
		    try {
		        let {data} = await axios.get('/api/account/user/link',params);
		        return [null, data]
		    } catch (e) {
		        return [e, null]
		    }
		},
		/**
		 * 获取帮助中心
		 * @param commit
		 * @param state
		 * @param params 请求参数
		 * @return {Promise<*[]>}
		 */
		async getHelpApi({commit, state}, params) {
		    try {
		        let {data} = await axios.get(`/api/account/basics/help/${params.client}`,params);
		        return [null, data]
		    } catch (e) {
		        return [e, null]
		    }
		},
		/**
		 * 修改余额支付密码
		 * @param commit
		 * @param state
		 * @param params 请求参数
		 * @return {Promise<*[]>}
		 */
		async upDateApi({commit, state}, params) {
		    try {
		        let {data} = await axios.put('/api/account/user/update',params);
		        return [null, data]
		    } catch (e) {
		        return [e, null]
		    }
		},
		/**
		 * 修改余额支付密码
		 * @param commit
		 * @param state
		 * @param params 请求参数
		 * @return {Promise<*[]>}
		 */
		async updateApi({commit, state}, params) {
		    try {
		        let {data} = await axios.post('/api/account/user_lawyer_history/update',params);
		        return [null, data]
		    } catch (e) {
		        return [e, null]
		    }
		},
		/**
		 * 判断是否有支付密码
		 * @param commit
		 * @param state
		 * @param params 请求参数
		 * @return {Promise<*[]>}
		 */
		async isPassApi({commit, state}, params) {
		    try {
		        let {data} = await axios.get('/api/finance/account_user/is_password',{params});
		        return [null, data]
		    } catch (e) {
		        return [e, null]
		    }
		},
		/**
		 * 验证密码是否正确
		 * @param commit
		 * @param state
		 * @param params 请求参数
		 * @return {Promise<*[]>}
		 */
		async matchesApi({commit, state}, params) {
		    try {
		        let {data} = await axios.put(`/api/finance/account_user/matches/${params.password}`,params);
		        return [null, data]
		    } catch (e) {
		        return [e, null]
		    }
		},
		/**
		 * 获取律师app
		 * @param commit
		 * @param state
		 * @param params 请求参数
		 * @return {Promise<*[]>}
		 */
		async historyOneApi({commit, state}, params) {
		    try {
		        let {data} = await axios.get('/api/account/lawyer_certification/one',{params});
		        return [null, data]
		    } catch (e) {
		        return [e, null]
		    }
		},
		/**
		 * 获取公告
		 * @param commit
		 * @param state
		 * @param params 请求参数
		 * @return {Promise<*[]>}
		 */
		async getNoticeApi({commit, state}, params) {
		    try {
		        let {data} = await axios.post('/api/sense/mobile/notice',params);
		        return [null, data]
		    } catch (e) {
		        return [e, null]
		    }
		},
		/**
		 * 手机H5支付
		 * @param commit
		 * @param state
		 * @param params 请求参数
		 * @return {Promise<*[]>}
		 */
		async mobilePayApi({commit, state}, params) {
		    try {
		        let {data} = await axios.get('/api/finance/unionpay/mobile_pay',{params});
		        return [null, data]
		    } catch (e) {
		        return [e, null]
		    }
		},
		/**
		 * 去支付-查询订单
		 * @param commit
		 * @param state
		 * @param params 请求参数
		 * @return {Promise<*[]>}
		 */
		async toPayApi({commit, state}, params) {
		    try {
		        let {data} = await axios.get('/api/cases/litigation/to_pay',{params});
		        return [null, data]
		    } catch (e) {
		        return [e, null]
		    }
		},
		/**
		 * 查询某个律师的案例信息
		 * @param commit
		 * @param state
		 * @param params 请求参数
		 * @return {Promise<*[]>}
		 */
		async lawyerCaseApi({commit, state}, params) {
		    try {
		        let {data} = await axios.get('/api/account/lawyer_case/query_lawyer',{params});
		        return [null, data]
		    } catch (e) {
		        return [e, null]
		    }
		},
		/**
		 * 查询案件类型
		 * @param commit
		 * @param state
		 * @param params 请求参数
		 * @return {Promise<*[]>}
		 */
		async caseTypeApi({commit, state}, params) {
		    try {
		        let {data} = await axios.get('/api/account/basics/case/type',{params});
		        let list = data;
		        list.forEach(item => {
		        	item.text = item.type_name;
		        	item.value = item.id;
		        	if (item.children&&item.children.length) {
		        		item.children.forEach(item1 => {
		        			delete item1.children;
		        		})
		        		item.children.unshift({type_name:''})
		        	}else{
		        		item.children = [{type_name:''}];
		        	}
		        })
				return [null, list]
		    } catch (e) {
		        return [e, null]
		    }
		},
		/**
		 * 评价列表
		 * @param commit
		 * @param state
		 * @param params 请求参数
		 * @return {Promise<*[]>}
		 */
		async evalPageApi({commit, state}, params) {
		    try {
		        let {data} = await axios.post('/api/im/evaluation/page',params);
		        return [null, data]
		    } catch (e) {
		        return [e, null]
		    }
		},
		/**
		 * 新增评价
		 * @param commit
		 * @param state
		 * @param params 请求参数
		 * @return {Promise<*[]>}
		 */
		async saveEvalApi({commit, state}, params) {
		    try {
		        let {data} = await axios.post('/api/im/evaluation/save',params);
		        return [null, data]
		    } catch (e) {
		        return [e, null]
		    }
		},
		/**
		 * 联系客服
		 * @param commit
		 * @param state
		 * @param params 请求参数
		 * @return {Promise<*[]>}
		 */
		async setUpApi({commit, state}, params) {
		    try {
		        let {data} = await axios.get('/api/account/setup',{params});
		        return [null, data]
		    } catch (e) {
		        return [e, null]
		    }
		},
		/**
		 * 查询一条认证信息
		 * @param commit
		 * @param state
		 * @param params 请求参数
		 * @return {Promise<*[e, data]>} e错误信息，data数据
		 */
		async certificationQueryApi({commit, state}, params) {
		    try {
		        let {data} = await axios.get(`/api/account/enterprise_certification/query/${params.userId}`);
		        return [null, data]
		    } catch (e) {
		        return [e, null]
		    }
		},
		
    }
}
